<template>
<div id="queryTemplate">
	<el-row>
		<el-col :span="24">
			<!-- <el-form :model="submitform"> -->
			<el-form :model="submitform" :status-icon="true" :show-message="false" :inline="true" ref="submitform" label-width="100px" class="demo-ruleForm">
				

				<el-row>
					<el-col :span="11" >
						<el-form-item label="交易日期" prop="settleDate">
                            <el-date-picker v-model="submitform.settleDate" value-format="yyyy-MM-dd" type="date" placeholder="选择日期"> </el-date-picker>
						</el-form-item>
					</el-col>
				</el-row>

                <el-row>
			
                    <el-col :span="11">
                        <el-form-item label="商户名称" prop="mchId.mchName">
                            <div  class="el-input el-input--small el-input-group el-input-group--append">
                                <input v-model="submitform.mchId.mchName" autocomplete="off" placeholder="请输入内容" size="small" type="text" rows="2" validateevent="true" class="el-input__inner">
                                <div class="el-input-group__append"  @click="innerDialogFormVisible = true" >
                                <i  class="el-icon-search"></i>
                                </div>
                                
                            </div>
                        </el-form-item>
                    </el-col>

                    <el-col :span="11" style=""> 
                        <el-form-item label="商户类型:" prop="mchId.mchType"
                        :rules="[{trigger: 'blur' }]"
                        >
                            <el-input v-model="submitform.mchId.mchType" :disabled="!stateBtnSubmit"></el-input>
                        </el-form-item>
                    </el-col>

				</el-row>

                <el-row>
			
                    <el-col :span="11" style=""> 
                        <el-form-item label="商户主键:" prop="mchId.id"
                        :rules="[{trigger: 'blur' }]"
                        >
                            <el-input v-model="submitform.mchId.id" :disabled="!stateBtnSubmit"></el-input>
                        </el-form-item>
                    </el-col>

                    <el-col :span="11">
                        <el-form-item label="商户代码" prop="mchCode">
                            <el-input v-model="submitform.mchCode" :disabled="!stateBtnSubmit" ></el-input>
                        </el-form-item>
                    </el-col>

				</el-row>

			</el-form>
		</el-col>
	</el-row>


    <!--查询提示弹出窗--> 
    <div class="query-pop-up">
        <el-dialog title="请输入要查询的字段" :append-to-body='true'  :visible.sync="innerDialogFormVisible" width="40%" @close="$emit('update:show', false)"  >
        
            <!-- 高级查询模板组件 -->
            <rulesMerchantFilesTable @query-data="getQueryData" @refresh-quey-data="refreshQueyData" :innerSubmitSearch.sync="innerSubmitSearch"></rulesMerchantFilesTable>

            <div slot="footer" class="dialog-footer">
                <el-button @click="innerDialogFormVisible = false" size="small">取 消</el-button>
                <el-button type="primary" @click="innerSubmitSearchBtn('true')" size="small">确定</el-button>
            </div>
        </el-dialog>
    </div>
</div>
	
</template>

<script>
import treeSelect from "@/components/tree/treeSelect";
import gridSelect from "@/components/grid/gridSelect";
import dropSelect from "@/components/select/dropSelect";
import rulesMerchantFilesTable from "@/views/modules/basicArchives/paymentRules/rulesMerchantFilesTable";

export default {
  name:'unionPayReconciliation_queryTemplate',
  components: {
	 treeSelect,
     gridSelect,
     dropSelect,
     rulesMerchantFilesTable
  },
  data() {
    return {
        stateBtnSubmit:false,
        innerSubmitSearch:undefined,//true 提交搜索，false 清空搜索条件
        innerDialogFormVisible: false,
        submitform: {
            settleDate:undefined,
            mchId: {
                id :undefined, 
                mchName :undefined,
                mchType :undefined
            },
            mchCode :undefined,
        },
        tableParams:{
          parentId: "1",
          pageNo : "1",
          pageSize : "10",
          reqCode : "1",
          orderBy : "",
          searchValue:""
		},
        tableTotal : 100, //总长度
        currentPage : 1, //当前页数
		pageSizes : 10, //分页数量
		innerVisible: false,
        isShow : true,
        loading:false  //加载遮罩层显示
      
    };
  },
  props: {
    submitRecord:{type:String,}
  },
  watch: {
    submitRecord: function(val) {
      if (val == "true") {
        this.$emit("query-data",this.submitform);
      }else if(val=="false"){
        this.$refs["submitform"].resetFields();
        setTimeout(()=>{
            this.$emit("refresh-quey-data",this.submitform);
            },200)
      };
      setTimeout(()=>{
        this.$emit("update:submitRecord","0");
      },200)
    },
  },
  
  // 
  methods:{
    show(parms){
        //清空用户选择
		this.submitSearch="false";
		this.innerDialogFormVisible=false;
        // this.tableParams.searchValue="";
        this.primaryId = undefined;
        this.clearChoose();
        this.getTableData(this.tableParams);
        //关闭表单页面
        this.isShow = parms;
	},

	innerSubmitSearchBtn(parms){
        console.log("parmsXXXXXXXXXXX : ", parms);
        this.innerSubmitSearch=parms;
        this.innerDialogFormVisible=false;
	},

	getQueryData(parms){//获得搜索条件
        console.log('获取搜索条件： ',parms);
        this._data.submitform.mchId.id = parms.id;
        this._data.submitform.mchId.mchName = parms.mchName;
        this._data.submitform.mchCode = parms.mchCode;

		this.innerDialogFormVisible=false;
		// this.currentPage=1;
        // this.tableParams.pageNo="1";
        // this.tableParams.pageSize="10";
        // this.tableParams.reqCode="-1";
		// var queryParamsVar = mergeQuery(this.tableParams,parms);
        // this.submitform.mchId=(queryParamsVar);
	},

	refreshQueyData(parms){//清空搜索内容
    	this.submitform = parms;
    },
    

  }
};
</script>

<style rel="stylesheet" lang="scss" scoped>

</style>